feat(rw-backend): materialize effective section ownership in siteIndex#74
Merged
Conversation
The siteIndex worker already materializes the dense `sections` registry from RwSite.listSections(). This adds an effective-ownership rollup: the worker now loads per-site ownership claims (written to section_ownership by the scan) and folds an effective owner into every section row. - migration: add entity_ref / entity_owner_ref + sections_owner_idx to `sections` (edited in place — siteIndex is unreleased) - effectiveOwnership.ts: pure computeSectionRows — attributes each section to its nearest claiming ancestor, falls back to the site-root sentinel then a null owner, and strips the claimer's path prefix so section_path is owner-relative - SectionOwnershipStore.listForSite: read side for the worker - runWorker: fetch claims alongside listSections/listPages and roll them up - plugin.ts: pass the existing sectionOwnershipStore into the worker Infra-only: no consumer reads the new columns yet (the comment inbox, a separate change, is the first reader). Known deferred debt: the scan (writes claims) and worker (reads claims) couple through section_ownership with no read-time consistency guard; bounded and self-healing within ~one scan cycle since ownership is part of the hashed SectionRow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extracts the effective section-ownership rollup out of the larger
feat/doc-comment-inboxbranch into a standalone change offmain, to shrink the inbox PR. Infra-only.The siteIndex worker already materializes the dense
sectionsregistry fromRwSite.listSections(). This adds a rollup layer: the worker loads per-site ownership claims (written tosection_ownershipby the scan) and folds an effective owner into every section row.entity_ref/entity_owner_ref+sections_owner_idxtosections(edited in place — siteIndex is unreleased)effectiveOwnership.ts: purecomputeSectionRows— attributes each section to its nearest claiming ancestor, falls back to the site-root sentinel then a null owner, and strips the claimer's path prefix sosection_pathis owner-relativeSectionOwnershipStore.listForSite: read side for the workerrunWorker: fetch claims alongsidelistSections/listPagesand roll them upplugin.ts: pass the existingsectionOwnershipStoreinto the workerScope
No consumer reads the new columns yet — the comment inbox (a separate change) is the first reader. This is deliberate pre-positioning.
Known deferred debt
The scan (writes claims) and worker (reads claims) couple through
section_ownershipwith no read-time consistency guard. Bounded and self-healing within ~one scan cycle, since ownership is part of the hashedSectionRow. The inbox PR (first reader) should revisit before adding generation plumbing.Testing
effectiveOwnershipunit tests (nearest-ancestor, sentinel fallback, null-owner, path-boundary stripping)SectionOwnershipStore.listForSite,runWorkerrollup + hash-stability, migration schema testyarn dev: 3 claims rolled up into 1368 attributed sections, owner-relative paths, no errors🤖 Generated with Claude Code